﻿<phone:PhoneApplicationPage 
    x:Class="Sinergija13.WP7App.Views.SpeakerDetailsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:customControls="clr-namespace:Phone.Controls;assembly=Phone.Controls" 
    xmlns:preview="clr-namespace:Phone7.Fx.Preview;assembly=Phone7.Fx.Preview"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
    xmlns:b="clr-namespace:Sinergija13.WP7App.Infrastructure.Behaviours"
    xmlns:prismInteractivity="clr-namespace:Microsoft.Practices.Prism.Interactivity;assembly=Microsoft.Practices.Prism.Interactivity"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 
    xmlns:delay="clr-namespace:Delay"
    xmlns:prismInteractionRequest="clr-namespace:Microsoft.Practices.Prism.Interactivity.InteractionRequest;assembly=Microsoft.Practices.Prism.Interactivity"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False"
    
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="White"
    
    Style="{StaticResource TransitionPageStyle}"
    
    DataContext="{Binding Source={StaticResource ViewModelLocator}, Path=SpeakerDetailsViewModel}"
    
    toolkit:TiltEffect.IsTiltEnabled="True"
    >

    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Loaded">
            <i:InvokeCommandAction Command="{Binding PageLoadedCommand}"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>

    <phone:PhoneApplicationPage.Resources>
        <!-- RESOURCES -->

        <!-- The group header template, for groups in the main list -->
        <DataTemplate x:Key="sessionGroupHeader">
            <Border Background="{StaticResource PhoneAccentBrush}" Padding="{StaticResource PhoneTouchTargetOverhang}">
                <TextBlock Text="{Binding Key}" Style="{StaticResource PhoneTextLargeStyle}" Foreground="White"/>
            </Border>
        </DataTemplate>

        <!-- The template for groups when they are items in the "jump list". Not setting -->
        <!-- the GroupItemTemplate property will disable "jump list" functionality. -->
        <DataTemplate x:Key="groupItemHeader">
            <Border Background="{StaticResource PhoneAccentBrush}" Margin="{StaticResource PhoneTouchTargetOverhang}" Padding="{StaticResource PhoneTouchTargetOverhang}">
                <TextBlock Text="{Binding Key}" Style="{StaticResource PhoneTextLargeStyle}" Foreground="White"/>
            </Border>
        </DataTemplate>

        <!-- The template for session items -->
        <DataTemplate x:Key="sessionItemTemplate">
            <Grid Margin="{StaticResource PhoneTouchTargetOverhang}">
                <toolkit:ContextMenuService.ContextMenu>
                    <toolkit:ContextMenu>
                        <toolkit:MenuItem Header="dodaj u odabrano" Visibility="{Binding IsFavourite,Converter={StaticResource NegativeVisibilityConverter}}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <i:InvokeCommandAction Command="{Binding Path=DataContext.ToggleFavCommand, ElementName=speakerSessions}" CommandParameter="{Binding}"/>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </toolkit:MenuItem>
                        <toolkit:MenuItem Header="ukloni iz odabranog" Visibility="{Binding IsFavourite,Converter={StaticResource VisibilityConverter}}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <i:InvokeCommandAction Command="{Binding Path=DataContext.ToggleFavCommand, ElementName=speakerSessions}" CommandParameter="{Binding}"/>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </toolkit:MenuItem>
                    </toolkit:ContextMenu>
                </toolkit:ContextMenuService.ContextMenu>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="40"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Rectangle Grid.Column="0" Margin="-6,0,6,0" Fill="{Binding TrackBackgroundColor}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                <StackPanel Grid.Column="0" Margin="-6,0,6,0" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center">
                    <TextBlock Text="{Binding TrackCode[0]}" TextAlignment="Center" FontFamily="{StaticResource PhoneFontFamilySemiBold}" FontSize="30" Foreground="White"/>
                    <TextBlock Text="{Binding TrackCode[1]}" TextAlignment="Center" FontFamily="{StaticResource PhoneFontFamilySemiBold}" FontSize="30" Foreground="White"/>
                    <TextBlock Text="{Binding TrackCode[2]}" TextAlignment="Center" FontFamily="{StaticResource PhoneFontFamilySemiBold}" FontSize="30" Foreground="White"/>
                </StackPanel>
                <Grid Grid.Column="1" VerticalAlignment="Stretch">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Text="{Binding Title}" Style="{StaticResource PhoneTextLargeStyle}" FontFamily="{StaticResource PhoneFontFamilySemiBold}" TextWrapping="Wrap" Margin="12,-10,12,6" Foreground="White"/>
                    <!--<TextBlock Text="{Binding MinorInfo}" Style="{StaticResource PhoneTextNormalStyle}" TextWrapping="Wrap" Margin="12,3,0,9"  FontFamily="{StaticResource PhoneFontFamilyNormal}"/>-->
                    <TextBlock Grid.Row="1" Text="{Binding TrackTitle}" Style="{StaticResource PhoneTextNormalStyle}" TextWrapping="Wrap" Margin="12,-5,0,10" FontFamily="{StaticResource PhoneFontFamilyNormal}" Foreground="White"/>
                    <Grid VerticalAlignment="Bottom" Grid.Row="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="3.6*"/>
                            <ColumnDefinition Width="1.4*"/>
                            <ColumnDefinition Width="1.4*"/>
                            <ColumnDefinition Width="2.5*"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" Text="&#x2665;" FontSize="22" Foreground="#ffef5124" Margin="12,-1,0,0" HorizontalAlignment="Left" FontFamily="Segoe UI Symbol" Visibility="{Binding IsFavourite,Converter={StaticResource VisibilityConverter}}"/>
                        <Rectangle Grid.Column="1" Fill="{Binding TrackColor}" Margin="0,0,6,0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
                        <TextBlock Grid.Column="1" Text="{Binding Level}" Margin="-1,-1,6,0" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/>
                        <Rectangle Grid.Column="2" Fill="{Binding TrackColor}" Margin="0,0,6,0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                        <TextBlock Grid.Column="2" Text="{Binding Language}" Margin="-1,-1,6,0" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/>
                        <Rectangle Grid.Column="3"  Fill="{Binding TrackColor}" Margin="0,0,6,0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                        <TextBlock Grid.Column="3" Text="{Binding Room}" Margin="-1,-1,6,0" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/>
                    </Grid>
                </Grid>
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="Tap">
                        <i:InvokeCommandAction Command="{Binding Path=DataContext.SessionSelectedCommand, ElementName=speakerSessions}" CommandParameter="{Binding}"/>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </Grid>
        </DataTemplate>
    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        
        <!--Pivot Control-->
        <controls:Pivot Title="Sinergija 13 - o predavaču" Foreground="White">
            <controls:Pivot.Background>
                <ImageBrush ImageSource="/Sinergija13.WP7App;component/Resources/Images/Background3.jpg"/>
            </controls:Pivot.Background>
            <controls:PivotItem Header="biografija">
                <StackPanel x:Name="ContentPanel" Margin="12,0,12,0">
                    <Grid Margin="{StaticResource PhoneTouchTargetOverhang}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <delay:PlaceImage Width="150" MaxHeight="150" PlaceholderSource="/Sinergija13.WP7App;component/Resources/Images/speaker-no-pic.png" Source="{Binding Picture}" VerticalAlignment="Top"/>
                        <StackPanel Grid.Column="1" VerticalAlignment="Top">
                            <TextBlock Text="{Binding FullName}" Style="{StaticResource PhoneTextLargeStyle}" TextWrapping="Wrap" FontFamily="{StaticResource PhoneFontFamilySemiBold}" Margin="12,-12,12,6" Foreground="White"/>
                            <TextBlock Text="{Binding Company}" Style="{StaticResource PhoneTextNormalStyle}" TextWrapping="Wrap" FontFamily="{StaticResource PhoneFontFamilySemiBold}" Foreground="White"/>
                        </StackPanel>
                    </Grid>
                    <customControls:ScrollableTextBlock  
                            Text="{Binding Bio}"           
                            HorizontalAlignment="Left"   
                            VerticalAlignment="Top" 
                            Height="422" 
                            Width="421" 
                            Margin="12,0,0,0"
                            Foreground="White"
                             />

                </StackPanel>
            </controls:PivotItem>
            <!--Pivot item two-->
            <controls:PivotItem Header="predavanja">
                <toolkit:LongListSelector x:Name="speakerSessions" Background="Transparent"
                    ItemsSource="{Binding SpeakerSessionInfos}"                     
                    GroupHeaderTemplate="{StaticResource sessionGroupHeader}"
                    GroupItemTemplate="{StaticResource groupItemHeader}"
                    ItemTemplate="{StaticResource sessionItemTemplate}">
                </toolkit:LongListSelector>
            </controls:PivotItem>
        </controls:Pivot>
    </Grid>

    <!--Sample code showing usage of ApplicationBar-->
    <!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="appbar_button1" IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton x:Name="appbar_button2" IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem x:Name="menuItem1" Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem x:Name="menuItem2" Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->

</phone:PhoneApplicationPage>
